/*Custom Dropdown function*/
$(function() {
	$(".arrowUp").each(function() {
		$(this).click(function() {
			//alert($(this).parents().find('.group'));

		});
	});
	$(".ci-dropdown").each(function() {
		$(this).click(function(e) {
			e.stopPropagation(e);
			$(this).toggleClass('active');
			$(this).find('ul').slideToggle(100);
		});
		$(this).mouseleave(function(e) {
			$(this).find('ul').slideUp(100);
			$(this).removeClass('active');
		});

		$(this).find('ul li a').click(function(e) {

			var current = $(this).text();

			$(this).parents(".ci-dropdown").find('p').text(current);
			$(this).parent('ul').toggle();
			$(this).removeClass('active');
		});
	});
});

/*UI Jquery function*/
$(function() {

	$("#accordion").accordion({
		heightStyle : "content",
		autoHeight : true,
		collapsible : true
	});
	$("#accordion1").accordion({
		heightStyle : "content",
		autoHeight : true,
		collapsible : true
	});
	$("#accordion2").accordion({
		heightStyle : "content",
		autoHeight : true,
		collapsible : true
	});
	$("#accordion3").accordion({
		heightStyle : "content",
		autoHeight : true,
		collapsible : true
	});
	$("#accordion5").accordion({
		heightStyle : "content",
		autoHeight : true,
		collapsible : true
	});

	$("#accordion6").accordion({
		heightStyle : "content",
		autoHeight : true,
		collapsible : true
	});

	$("#accordion7").accordion({
		heightStyle : "content",
		autoHeight : true,
		collapsible : true
	});

	$("#accordion8").accordion({
		heightStyle : "content",
		autoHeight : true,
		collapsible : true
	});

	$("#accordion9").accordion({
		heightStyle : "content",
		autoHeight : true,
		collapsible : true
	});

	$("#accordion10").accordion({
		heightStyle : "content",
		autoHeight : true,
		collapsible : true
	});
	$(".accordion2").accordion({
		autoHeight : true,
		collapsible : true
	});
	$(".accordion3").accordion({
		autoHeight : true,
		collapsible : true
	});
	$("#accordion4").accordion({
		autoHeight : true,
		collapsible : true
	});

	$("#accordionSortable").accordion({
		header : "> div > h3"
	}).sortable({
		axis : "y",
		handle : "h3",
		stop : function(event, ui) {
			// IE doesn't register the blur when sorting
			// so trigger focusout handlers to remove .ui-state-focus
			ui.item.children("h3").triggerHandler("focusout");
		}
	});

	$('.floorContentadded ul li:last-child').addClass('last');

	$('.floorSection ul li:last-child').addClass('last');
	$('ul.subList li:last-child').addClass('last');

	$('div.archivedData div.archivedBox:first-child').addClass('first');
	$('div.archivedData div.archivedBox:last-child').addClass('last');

	$('.schoolEventstable tr').each(function() {
		$(this).hover(function() {
			$(this).children('td').addClass('hover');
		});
		$(this).mouseleave(function(e) {
			$('.schoolEventstable tr td').removeClass('hover');
		});
	});

	$('.activeAcYear .schoolEventstable tr, .inActiveAcYear .schoolEventstable tr, .mark tr, .myClass .schoolEventstable tr').each(function() {
		$(this).hover(function() {
			$(this).children('td').removeClass('hover');
		});
	});

	$('.spin-left-arrow').click(function() {
		$(this).parents(".spinner").find('.up').show();
		$(this).parents(".spinner").find('.down').hide();
	});
	$('.spin-right-arrow').click(function() {
		$(this).parents(".spinner").find('.down').show();
		$(this).parents(".spinner").find('.up').hide();
	});

	$("#tabs").tabs();
	$("#tabs1").tabs();

	$("#tabs11").tabs();
	$("#tabs12").tabs();
	$("#tabs13").tabs();
	$("#tabs14").tabs();
	$("#tabs21").tabs();
	$("#tabs22").tabs();
	$("#tabs23").tabs();
	$("#tabs24").tabs();
	$("#tabs31").tabs();
	$("#tabs32").tabs();
	$("#tabs33").tabs();
	$("#tabs34").tabs();
	$("#tabs41").tabs();
	$("#tabs42").tabs();
	$("#tabs43").tabs();
	$("#tabs44").tabs();
	$(".tabs2").tabs();

	$("#tabsdb1").tabs();
	$("#tabspopup").tabs();
	$("#tabspopup1").tabs();

	$('input.valIn').each(function(i, input) {
		$('.progressbar').eq(i).progressbar({
			value : Number($(input).val())
		});
	});

	$(document).tooltip();
	$(".selector").tooltip({
		content : "Awesome title!"
	});

	console.log("in common");
	$(".datepicker").datepicker({
		changeMonth : true,
		changeYear : true
	});
	$(".datepickerIcon").datepicker({
		changeMonth : true,
		changeYear : true,
		showOn : "button",
		buttonImage : "/ce-static-testedge/common/images/calendar.png",
		buttonImageOnly : true,
		altField : ".datepickerIcon",
		altFormat : "DD, d MM, yy"
	});

	var settings = {
		autoReinitialise : true
	};
	var pane = $('.scroll-pane')
	pane.jScrollPane(settings);

	var pane = $('.scroll-paneH')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane1')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane2')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane4')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane5')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane6')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane7')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane8')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane9')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane10')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane11')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane12')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane13')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane14')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane15')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane16')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane17')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane18')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane19')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane20')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane21')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane22')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane23')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane24')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane25')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane26')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane27')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane28')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane29')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane30')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane31')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane32')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane33')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane34')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane35')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane36')
	pane.jScrollPane(settings);

	var pane = $('.sBWrapper, .SBWrapper')
	pane.jScrollPane(settings);

});

/* Expand All for Accordian */
$(function() {
	$('#expandAccord').click(function(event) {
		$('#accordion h3').next().slideDown('normal');
		$('#accordion h3').addClass('active');
	});

	$('#expandAll').click(function(event) {
		$('.accordion3 h3').next().slideDown('normal');
		$('.accordion3 h3').addClass('active');
	});
});
$(function() {
	$('.actionButtonTr').hover(function() {
		$('.actionButtonTr .actionButtonTd').children('a').addClass('actionButtonsShow');
	});

	$('.actionButtonTr').mouseleave(function() {
		$('.actionButtonTr .actionButtonTd').children('a').removeClass('actionButtonsShow');
	});

});

/* Sho Add Device tables */
$(function() {
	$('#AddDevicesOkay').click(function(event) {
		$('#devicesMain').show(); {
			$('#addDevicesBottomBtns').show();
		}
	});
});

/* Insert new question set */
$(function() {
	$('#insertQuestionLink').click(function(event) {
		$('#newQuestionSet').show();
	});
});

/* Function to show Select Periods Checkboxes */
$(function() {
	$('.period').bind("change", function() {
		if ($(this).val() == "3") {
			$('#selectPeriodsCheckboxes').show();
		} else if ($(this).val() == "1", "2") {
			$('#selectPeriodsCheckboxes').hide();
		}
	});

	$('.optionAlternate').each(function() {
		var td = $(this).parent('td');
		var spin = td.next('td').children('span.wrap')

		$(this).bind("change", function() {
			if ($(this).val() == "2") {
				spin.show();
			} else if ($(this).val() == "1") {
				spin.hide();
			}

		});

	});

});
/* Function to show Question Paper Section */
$(function() {
	$('#createPaperTempOk').click(function(event) {
		$('#defineQuesPaperMain').show();
	});
});

/* Function to show Alternate Section option */
$(function() {
	$('#altSectionOpt1').click(function(event) {
		$('#altSection1').show(); {
			$('#altSection1TR TD').css("background-color", "#FFC");
		}
	});

	$('#altSectionOpt2').click(function(event) {
		$('#altSection2').show(); {
			$('#altSection2TR TD').css("background-color", "#FFC");
		}
	});

	$('#altSectionOpt3').click(function(event) {
		$('#altSection3').show(); {
			$('#altSection3TR TD').css("background-color", "#FFC");
		}
	});

	$('#altSectionOpt4').click(function(event) {
		$('#altSection4').show(); {
			$('#altSection4TR TD').css("background-color", "#FFC");
		}
	});
});

/* Function to hide Alternate Section option */
$(function() {
	$('#mandSectionOpt1').click(function(event) {
		$('#altSection1').hide(); {
			$('#altSection1TR TD').css("background-color", "#FFF");
		}
	});

	$('#mandSectionOpt2').click(function(event) {
		$('#altSection2').hide(); {
			$('#altSection2TR TD').css("background-color", "#FFF");
		}
	});

	$('#mandSectionOpt3').click(function(event) {
		$('#altSection3').hide(); {
			$('#altSection3TR TD').css("background-color", "#FFF");
		}
	});

	$('#mandSectionOpt4').click(function(event) {
		$('#altSection4').hide(); {
			$('#altSection4TR TD').css("background-color", "#FFF");
		}
	});
});

/* JqueryUI Dialog function*/

$(function() {
	$("#dialog-student").dialog({
		autoOpen : false,
		width : 898,
		modal : true
	});
	$(".add-student").click(function() {
		$("#dialog-student").dialog("open");
	});
	$("#saveInfo").click(function() {
		$("#dialog-student").dialog("close");
	});
	$("#cencelBox").click(function() {
		$("#dialog-student").dialog("close");
	});

	$("#add-Scores").dialog({
		autoOpen : false,
		width : 898,
		modal : true
	});
	$(".addScores").click(function() {
		$("#add-Scores").dialog("open");
	});
	$("#add-Scores #saveAndC").click(function() {
		$("#add-Scores").dialog("close");
	});
	$("#add-Scores #save").click(function() {
		$("#add-Scores").dialog("close");
	});
	$("#add-Scores #cencel").click(function() {
		$("#add-Scores").dialog("close");
	});

	$("#add-ScoresRecords").dialog({
		autoOpen : false,
		width : 450,
		modal : true
	});
	$(".addScoreR").click(function() {
		$("#add-ScoresRecords").dialog("open");
	});
	$("#add-ScoresRecords #save").click(function() {
		$("#add-ScoresRecords").dialog("close");
	});
	$("#add-ScoresRecords #cencel").click(function() {
		$("#add-ScoresRecords").dialog("close");
	});

	
	$("#edit-timeTable").dialog({
		autoOpen : false,
		width : 300,
		modal : true
	});
	$(".edittimeTable").click(function() {
		$("#edit-timeTable").dialog("open");
	});
	$("#edit-timeTable #save").click(function() {
		$("#edit-timeTable").dialog("close");
	});
	$("#edit-timeTable #cencel").click(function() {
		$("#edit-timeTable").dialog("close");
	});

	$("#edit-timeTable1").dialog({
		autoOpen : false,
		width : 300,
		modal : true
	});
	$(".edittimeTable1").click(function() {
		$("#edit-timeTable1").dialog("open");
	});
	$("#edit-timeTable1 #save").click(function() {
		$("#edit-timeTable1").dialog("close");
	});
	$("#edit-timeTable1 #cencel").click(function() {
		$("#edit-timeTable1").dialog("close");
	});

	$("#view-Rules").dialog({
		autoOpen : false,
		width : 600,
		modal : true
	});
	$(".viewRules").click(function() {
		$("#view-Rules").dialog("open");
	});
	$("#view-Rules #save").click(function() {
		$("#view-Rules").dialog("close");
	});
	$("#view-Rules #cencel").click(function() {
		$("#view-Rules").dialog("close");
	});

	$("#add-Remark").dialog({
		autoOpen : false,
		width : 898,
		modal : true
	});
	$(".addRemark").click(function() {
		$("#add-Remark").dialog("open");
	});
	$("#add-Remark #save").click(function() {
		$("#add-Remark").dialog("close");
	});
	$("#add-Remark #cencel").click(function() {
		$("#add-Remark").dialog("close");
	});

	$("#dialog-studentInfo").dialog({
		autoOpen : false,
		width : 770,
		modal : true
	});
	$(".studentInfo").click(function() {
		$("#dialog-studentInfo").dialog("open");
	});
	$("#dialog-studentInfo #saveInfo").click(function() {
		$("#dialog-studentInfo").dialog("close");
	});
	$("#dialog-studentInfo #cencelBox").click(function() {
		$("#dialog-studentInfo").dialog("close");
	});

	$("#dialog-schollInfo").dialog({
		autoOpen : false,
		width : 450,
		modal : true
	});
	$(".schollInfo").click(function() {
		$("#dialog-schollInfo").dialog("open");
	});
	$("#dialog-schollInfo #saveInfo").click(function() {
		$("#dialog-schollInfo").dialog("close");
	});
	$("#dialog-schollInfo #cencelBox").click(function() {
		$("#dialog-schollInfo").dialog("close");
	});

	$("#chapters").dialog({
		autoOpen : false,
		width : 600,
		modal : true
	});
	$(".chapter").click(function() {
		$("#chapters").dialog("open");
	});
	$("#chapters #okay").click(function() {
		$("#chapters").dialog("close");
	});
	$("#chapters #cencel").click(function() {
		$("#chapters").dialog("close");
	});

	$("#insert-Chapter").dialog({
		autoOpen : false,
		width : 600,
		modal : true
	});
	$(".insertChapter").click(function() {
		$("#insert-Chapter").dialog("open");
	});
	$("#insert-Chapter #okay").click(function() {
		$("#insert-Chapter").dialog("close");
	});
	$("#insert-Chapter #cencel").click(function() {
		$("#insert-Chapter").dialog("close");
	});

	$("#plan-Progress").dialog({
		autoOpen : false,
		width : 700,
		modal : true
	});
	$(".planProgress").click(function() {
		$("#plan-Progress").dialog("open");
	});
	$("#plan-Progress #okay").click(function() {
		$("#plan-Progress").dialog("close");
	});
	$("#plan-Progress #cencel").click(function() {
		$("#plan-Progress").dialog("close");
	});

	$("#view-All").dialog({
		autoOpen : false,
		width : 700,
		modal : true
	});
	$(".viewAll").click(function() {
		$("#view-All").dialog("open");
	});
	$("#view-All #okay").click(function() {
		$("#view-All").dialog("close");
	});
	$("#view-All #cencel").click(function() {
		$("#view-All").dialog("close");
	});

	$("#Assessment-Tracker").dialog({
		autoOpen : false,
		width : 800,
		modal : true
	});
	$(".AssessmentTracker").click(function() {
		$("#Assessment-Tracker").dialog("open");
	});
	$("#Assessment-Tracker #okay").click(function() {
		$("#Assessment-Tracker").dialog("close");
	});
	$("#Assessment-Tracker #cencel").click(function() {
		$("#Assessment-Tracker").dialog("close");
	});

	
	$("#dialog-define").dialog({
		autoOpen : false,
		width : 898,
		modal : true
	});
	$(".subjects").click(function() {
		$("#dialog-define").dialog("open");
	});
	$("#dialog-define #saveInfo").click(function() {
		$("#dialog-define").dialog("close");
	});
	$("#dialog-define #cencelBox").click(function() {
		$("#dialog-define").dialog("close");
	});

	$("#create-Section").dialog({
		autoOpen : false,
		width : 898,
		modal : true
	});
	$(".createSection").click(function() {
		$("#create-Section").dialog("open");
	});
	$("#saveInfo").click(function() {
		//$( "#create-Section" ).dialog( "close" );
	});
	$("#cencelBox").click(function() {
		$("#create-Section").dialog("close");
	});

	$("#sub-CoScholastic").dialog({
		autoOpen : false,
		width : 898,
		modal : true
	});
	$(".subCoScholastic").click(function() {
		$("#sub-CoScholastic").dialog("open");
	});
	$("#saveInfo").click(function() {
		$("#sub-CoScholastic").dialog("close");
	});
	$("#cencelBox").click(function() {
		$("#sub-CoScholastic").dialog("close");
	});

	$("#add-Term").dialog({
		autoOpen : false,
		width : 898,
		modal : true
	});
	$(".addTerm").click(function() {
		$("#add-Term").dialog("open");
	});
	$("#add-Term #saveInfo").click(function() {
		$("#add-Term").dialog("close");
	});
	$("#add-Term #cencelBox").click(function() {
		$("#add-Term").dialog("close");
	});

	$("#dialog-summative").dialog({
		autoOpen : false,
		width : 898,
		modal : true
	});
	$(".summative").click(function() {
		$("#dialog-summative").dialog("open");
	});
	$("#dialog-summative #save").click(function() {
		$("#dialog-summative").dialog("close");
	});
	$("#dialog-summative #cencel").click(function() {
		$("#dialog-summative").dialog("close");
	});

	$("#dialog-divice").dialog({
		autoOpen : false,
		width : 898,
		modal : true
	});
	$(".divice").click(function() {
		$("#dialog-divice").dialog("open");
	});
	$("#dialog-divice #save").click(function() {
		$("#dialog-divice").dialog("close");
	});
	$("#dialog-divice #cencel").click(function() {
		$("#dialog-divice").dialog("close");
	});

	$("#dialog-grid").dialog({
		autoOpen : false,
		width : 898,
		modal : true
	});
	$(".grid").click(function() {
		$("#dialog-grid").dialog("open");
	});
	$("#dialog-grid #save").click(function() {
		$("#dialog-grid").dialog("close");
	});
	$("#dialog-grid #cencel").click(function() {
		$("#dialog-grid").dialog("close");
	});

	$("#assignment").dialog({
		autoOpen : false,
		width : 600,
		modal : true
	});
	$(".asgnmnt").click(function() {
		$("#assignment").dialog("open");
	});
	$("#assignment #save").click(function() {
		$("#assignment").dialog("close");
	});
	$("#assignment #publish").click(function() {
		$("#dialog-publish").dialog("open");
	});
	$("#assignment #cencel").click(function() {
		$("#assignment").dialog("close");
	});

	$("#dialog-Assignment").dialog({
		autoOpen : false,
		width : 420,
		modal : true
	});
	$(".assigBox").click(function() {
		$("#dialog-Assignment").dialog("open");
	});
	$("#dialog-Assignment #confirm").click(function() {
		$("#dialog-Assignment").dialog("close");
	});
	$("#dialog-Assignment #cencel").click(function() {
		$("#dialog-Assignment").dialog("close");
	});

	$("#add-Event").dialog({
		autoOpen : false,
		width : 420,
		modal : true
	});
	$(".addEvent").click(function() {
		$("#add-Event").dialog("open");
	});
	$("#saveInfo1").click(function() {
		//$( "#add-Event" ).dialog( "close" );
	});
	$("#cencelBox1").click(function() {
		$("#add-Event").dialog("close");
	});

	$("#dialog-Archive").dialog({
		autoOpen : false,
		width : 420,
		modal : true
	});
	$(".archive").click(function() {
		$("#dialog-Archive").dialog("open");
	});
	$("#dialog-Archive #confirm").click(function() {
		$("#dialog-Archive").dialog("close");
	});
	$("#dialog-Archive #cancle").click(function() {
		$("#dialog-Archive").dialog("close");
	});

	$("#dialog-Analysis").dialog({
		autoOpen : false,
		width : 420,
		modal : true
	});
	$(".analysis").click(function() {
		$("#dialog-Analysis").dialog("open");
	});
	$("#dialog-Analysis #save").click(function() {
		$("#dialog-Analysis").dialog("close");
	});
	$("#dialog-Analysis #cancel").click(function() {
		$("#dialog-Analysis").dialog("close");
	});

	$("#sub-CoScholastic").dialog({
		autoOpen : false,
		width : 898,
		modal : true
	});
	$(".subCoScholastic").click(function() {
		$("#sub-CoScholastic").dialog("open");
	});
	$("#saveInfo").click(function() {
		$("#sub-CoScholastic").dialog("close");
	});
	$("#cencelBox").click(function() {
		$("#sub-CoScholastic").dialog("close");
	});

	// $( "#add-Schedule" ).dialog({
	// autoOpen: false,
	// width: 650,
	// modal: true
	// });
	// $( ".addSchedule" ).click(function() {
	// $( "#add-Schedule" ).dialog( "open" );
	// });
	// $( "#saveInfo2" ).click(function() {
	// $( "#add-Schedule" ).dialog( "close" );
	// });
	// $( "#cencelBox2" ).click(function() {
	// $( "#add-Schedule" ).dialog( "close" );
	// });

	$("#automated-timetable").dialog({
		autoOpen : false,
		width : 327,
		modal : true
	});
	$(".automated").click(function() {
		$("#automated-timetable").dialog("open");
	});
	$("#automated-timetable #ok").click(function() {
		$("#automated-timetable").dialog("close");
	});
	$("#automated-timetable #cencel").click(function() {
		$("#automated-timetable").dialog("close");
	});

	$("#create-TimeTable").dialog({
		autoOpen : false,
		width : 327,
		modal : true
	});
	$(".createTimeTable").click(function() {
		$("#create-TimeTable").dialog("open");
	});
	$("#create-TimeTable #ok").click(function() {
		$("#create-TimeTable").dialog("close");
	});
	$("#create-TimeTable #cencel").click(function() {
		$("#create-TimeTable").dialog("close");
	});

	$("#view-Teachers").dialog({
		autoOpen : false,
		width : 327,
		modal : true
	});
	$(".viewTeachers").click(function() {
		$("#view-Teachers").dialog("open");
	});
	$("#view-Teachers #saveInfo").click(function() {
		$("#view-Teachers").dialog("close");
	});
	$("#view-Teachers #cencelBox").click(function() {
		$("#view-Teachers").dialog("close");
	});

	$("#dialog-publish").dialog({
		autoOpen : false,
		width : 327,
		modal : true
	});
	$(".publish").click(function() {
		$("#dialog-publish").dialog("open");
	});
	$("#dialog-publish #confirm").click(function() {
		$("#dialog-publish").dialog("close");
	});
	$("#dialog-publish #cencel").click(function() {
		$("#dialog-publish").dialog("close");
	});

	$("#dialog-publish").dialog({
		autoOpen : false,
		width : 327,
		modal : true
	});
	$(".publish").click(function() {
		$("#dialog-publish").dialog("open");
	});
	$("#dialog-publish #confirm").click(function() {
		$("#dialog-publish").dialog("close");
	});
	$("#dialog-publish #cencel").click(function() {
		$("#dialog-publish").dialog("close");
	});

	$("#dialog-Generate").dialog({
		autoOpen : false,
		width : 327,
		modal : true
	});
	$(".generate").click(function() {
		$("#dialog-Generate").dialog("open");
	});
	$("#dialog-Generate #confirm").click(function() {
		$("#dialog-Generate").dialog("close");
	});
	$("#dialog-Generate #cencel").click(function() {
		$("#dialog-Generate").dialog("close");
	});

	$("#assign-Subject").dialog({
		autoOpen : false,
		width : 420,
		modal : true
	});
	$(".assign").click(function() {
		$("#assign-Subject").dialog("open");
	});
	$("#assign-Subject #save").click(function() {
		$("#assign-Subject").dialog("close");
	});
	$("#assign-Subject #cencel").click(function() {
		$("#assign-Subject").dialog("close");
	});

	$("#create-Shift").dialog({
		autoOpen : false,
		width : 520,
		modal : true
	});
	$(".createShift").click(function() {
		$("#create-Shift").dialog("open");
	});
	$("#create-Shift #save").click(function() {
		$("#create-Shift").dialog("close");
	});
	$("#create-Shift #cencel").click(function() {
		$("#create-Shift").dialog("close");
	});

	$("#dialog-clone").dialog({
		autoOpen : false,
		width : 420,
		modal : true
	});
	$(".clone").click(function() {
		$("#dialog-clone").dialog("open");
	});
	$("#dialog-clone #clone").click(function() {
		$("#dialog-clone").dialog("close");
	});
	$("#dialog-clone #cencel").click(function() {
		$("#dialog-clone").dialog("close");
	});

	$("#teachersDetails").dialog({
		autoOpen : false,
		width : 700,
		modal : true
	});
	$(".teacherDtl").click(function() {
		$("#teachersDetails").dialog("open");
	});
	$("#teachersDetails #saveInfo").click(function() {
		$("#teachersDetails").dialog("close");
	});
	$("#teachersDetails #cencel").click(function() {
		$("#teachersDetails").dialog("close");
	});

	$("#add-Test").dialog({
		autoOpen : false,
		width : 400,
		modal : true
	});
	$(".addTest").click(function() {
		$("#add-Test").dialog("open");
	});
	$("#add-Test #save").click(function() {
		$("#add-Test").dialog("close");
	});
	$("#add-Test #cencel").click(function() {
		$("#add-Test").dialog("close");
	});

	$("#add-Test1").dialog({
		autoOpen : false,
		width : 400,
		modal : true
	});
	$(".addTest1").click(function() {
		$("#add-Test1").dialog("open");
	});
	$("#add-Test1 #save").click(function() {
		$("#add-Test1").dialog("close");
	});
	$("#add-Test1 #cencel").click(function() {
		$("#add-Test1").dialog("close");
	});

	/* function to show Assign Roll Numbers Dialog box */
	$("#assign-roll").dialog({
		autoOpen : false,
		width : 400,
		modal : true
	});
	$(".assignRoll").click(function() {
		$("#assign-roll").dialog("open");
	});
	$("#assign-roll #saveInfo").click(function() {
		$("#assign-roll").dialog("close");
	});
	$("#assign-roll #cencelBox").click(function() {
		$("#assign-roll").dialog("close");
	});

	//Add Marks dialog box
	/*$( "#add-marks" ).dialog({
	autoOpen: false,
	width: 400,
	modal: true
	});
	$( ".addMarks" ).click(function() {
	$( "#add-marks" ).dialog( "open" );
	});
	$( "#add-marks #proceed" ).click(function() {
	$( "#add-marks" ).dialog( "close" );
	});
	$( "#add-marks #cencelBox" ).click(function() {
	$( "#add-marks" ).dialog( "close" );
	});

	//Add Marks dialog box
	$( "#addMark" ).dialog({
	autoOpen: false,
	width: 400,
	modal: true
	});
	$( ".addMark" ).click(function() {
	$( "#addMark" ).dialog( "open" );
	});
	$( "#addMark #proceed" ).click(function() {
	$( "#addMark" ).dialog( "close" );
	});
	$( "#addMark #cencel" ).click(function() {
	$( "#addMark" ).dialog( "close" );
	});
	*/

	//Course Completion dialog box
	$("#course-completion").dialog({
		autoOpen : false,
		width : 898,
		modal : true
	});
	$(".courseCompletion").click(function() {
		$("#course-completion").dialog("open");
	});
	$("#course-completion #okay").click(function() {
		$("#course-completion").dialog("close");
	});
	$("#course-completion #cencelBox").click(function() {
		$("#course-completion").dialog("close");
	});

	//Class Performance dialog box
	$("#class-performance").dialog({
		autoOpen : false,
		width : 898,
		modal : true
	});
	$(".classPerform").click(function() {
		$("#class-performance").dialog("open");
	});
	$("#class-performance #okay").click(function() {
		$("#class-performance").dialog("close");
	});
	$("#class-performance #cencelBox").click(function() {
		$("#class-performance").dialog("close");
	});

	$("#view-Plan").dialog({
		autoOpen : false,
		width : 934,
		modal : true
	});
	$(".viewPlan").click(function() {
		$("#view-Plan").dialog("open");
	});
	$("#view-Plan #ok").click(function() {
		$("#view-Plan ").dialog("close");
	});
	$("#view-Plan #cencel").click(function() {
		$("#view-Plan").dialog("close");
	});

	/* Get Chapter List popup */
	$("#get-chapterList").dialog({
		autoOpen : false,
		width : 400,
		modal : true
	});
	$(".getChapterList").click(function() {
		$("#get-chapterList").dialog("open");
	});
	$("#okay1").click(function() {
		if ($('#retrieveRdo').is(':checked')) {
			$("#retrieve-chapterList").dialog("open");
		}
		if ($('#createRdo').is(':checked')) {
			$("#create-chapterList").dialog("open");
		}
		$("#get-chapterList").dialog("close");
	});
	$("#get-chapterList #cencelBox").click(function() {
		$("#get-chapterList").dialog("close");
	});

	// Retrieve Chapter List from testEdge popup
	$("#retrieve-chapterList").dialog({
		autoOpen : false,
		width : 600,
		modal : true
	});
	$("#okay2").click(function() {
		$("#retrieve-chapterList").dialog("close");

	});
	$("#retrieve-chapterList #cencelBox").click(function() {
		$("#retrieve-chapterList").dialog("close");
	});

	// Retrieve Chapter List from testEdge popup
	$("#create-chapterList").dialog({
		autoOpen : false,
		width : 350,
		modal : true
	});
	$("#okay3").click(function() {
		$("#create-chapterList").dialog("close");

	});
	$("#create-chapterList #cencelBox").click(function() {
		$("#create-chapterList").dialog("close");
	});

	/* Confirm Save Plan popup */
	$("#confirm-savePlan").dialog({
		autoOpen : false,
		width : 400,
		modal : true
	});
	$(".confirmSavePlan").click(function() {
		$("#confirm-savePlan").dialog("open");
	});
	$("#confirm-savePlan #confirm").click(function() {
		$("#confirm-savePlan").dialog("close");
	});
	$("#confirm-savePlan #cencelBox").click(function() {
		$("#confirm-savePlan").dialog("close");
	});

	/* Repeat Year popup */
	$("#repeat-year").dialog({
		autoOpen : false,
		width : 400,
		modal : true
	});
	$(".repeatYear").click(function() {
		$("#repeat-year").dialog("open");
	});
	$("#repeat-year #repeatYearSave").click(function() {
		$("#repeat-year").dialog("close");
	});
	$("#repeat-year #cencelBox").click(function() {
		$("#repeat-year").dialog("close");
	});

	/* Inactive Year popup */
	$("#inactive-year").dialog({
		autoOpen : false,
		width : 420,
		modal : true
	});
	$(".inactiveYear").click(function() {
		$("#inactive-year").dialog("open");
	});
	$("#inactive-year #inactiveOkay").click(function() {
		$("#inactive-year").dialog("close");
	});
	$("#inactive-year #cencelBox").click(function() {
		$("#inactive-year").dialog("close");
	});

	/* Add Devices popup */
	$("#add-devices").dialog({
		autoOpen : false,
		width : 898,
		modal : true
	});
	$(".addDevices").click(function() {
		$("#add-devices").dialog("open");
	});
	$("#add-devices #AddDevicesSave").click(function() {
		$("#add-devices").dialog("close");
	});
	$("#add-devices #cencelBox").click(function() {
		$("#add-devices").dialog("close");
	});

	/* Create New Paper Template Popup */
	$("#create-paperTemplate").dialog({
		autoOpen : false,
		width : 898,
		modal : true
	});
	$(".createPaperTemplate").click(function() {
		$("#create-paperTemplate").dialog("open");
	});
	$("#create-paperTemplate #createPaperTempSave").click(function() {
		$("#create-paperTemplate").dialog("close");
	});
	$("#create-paperTemplate #cencelBox").click(function() {
		$("#create-paperTemplate").dialog("close");
	});

	$("#dialog-confirm2").dialog({
		autoOpen : false,
		width : 420,
		modal : true
	});
	$("#radio1").click(function() {
		$("#dialog-confirm2").dialog("open");
	});
	$("#dialog-confirm2 #delete").click(function() {
		$("#dialog-confirm2").dialog("close");
	});
	$("#dialog-confirm2 #cencel").click(function() {
		$("#dialog-confirm2").dialog("close");
	});

	$("#dialog-confirm3").dialog({
		autoOpen : false,
		width : 420,
		modal : true
	});
	$("#radio2").click(function() {
		$("#dialog-confirm3").dialog("open");
	});
	$("#dialog-confirm3 #delete").click(function() {
		$("#dialog-confirm3").dialog("close");
	});
	$("#dialog-confirm3 #cencel").click(function() {
		$("#dialog-confirm3").dialog("close");
	});

	$("#dialog-confirm4").dialog({
		autoOpen : false,
		width : 420,
		modal : true
	});
	$("#radio3").click(function() {
		$("#dialog-confirm4").dialog("open");
	});
	$("#dialog-confirm4 #delete").click(function() {
		$("#dialog-confirm4").dialog("close");
	});
	$("#dialog-confirm4 #cencel").click(function() {
		$("#dialog-confirm4").dialog("close");
	});

	$("#dialog-confirm5").dialog({
		autoOpen : false,
		width : 200,
		modal : true
	});
	$(".selectGp").click(function() {
		$("#dialog-confirm5").dialog("open");
	});
	$("#dialog-confirm5 #done").click(function() {
		$("#dialog-confirm5").dialog("close");
	});
	$("#dialog-confirm5 #cencel").click(function() {
		$("#dialog-confirm5").dialog("close");
	});

	$("#dialog-confirm6").dialog({
		autoOpen : false,
		width : 380,
		modal : true
	});
	$(".share").click(function() {
		$("#dialog-confirm6").dialog("open");
	});
	$("#dialog-confirm6 #confirm").click(function() {
		$("#dialog-confirm6").dialog("close");
	});
	$("#dialog-confirm6 #cencel").click(function() {
		$("#dialog-confirm6").dialog("close");
	});

	/*$( "#dialog-Ruls" ).dialog({
	 autoOpen: false,
	 width: 500,
	 modal: true
	 });
	 $( ".ruls" ).click(function() {
	 $( "#dialog-Ruls" ).dialog( "open" );
	 });
	 $( "#dialog-Ruls #calcu" ).click(function() {
	 $( "#dialog-Ruls" ).dialog( "close" );
	 });
	 $( "#dialog-Ruls #cancel" ).click(function() {
	 $( "#dialog-Ruls" ).dialog( "close" );
	 });*/
	$("#report-Cards").dialog({
		autoOpen : false,
		width : 450,
		modal : true
	});
	$(".reportCards").click(function() {
		$("#report-Cards").dialog("open");
	});
	$("#report-Cards #ok").click(function() {
		$("#report-Cards").dialog("close");
	});
	$("#report-Cards #print").click(function() {
		$("#report-Cards").dialog("close");
	});
	$("#report-Cards #cancel").click(function() {
		$("#report-Cards").dialog("close");
	});

	
	$("#Qtype").bind("change", function() {
		if ($(this).val() == "2") {
			$("#create-a-question").dialog("close");
			$("#createQuestion-MCQSingleSelct").dialog("open");
		}
	});

	$("#Qtype").bind("change", function() {
		if ($(this).val() == "3") {
			$("#create-a-question").dialog("close");
			$("#createQuestion-MCQMultipleSelct").dialog("open");
		}
	});

	$("#Qtype").bind("change", function() {
		if ($(this).val() == "4") {
			$("#create-a-question").dialog("close");
			$("#createQuestion-MCQTwoOpt").dialog("open");
		}
	});

	$("#Qtype").bind("change", function() {
		if ($(this).val() == "5") {
			$("#create-a-question").dialog("close");
			$("#createQuestion-FibInterchangable").dialog("open");
		}
	});

	$("#Qtype").bind("change", function() {
		if ($(this).val() == "6") {
			$("#create-a-question").dialog("close");
			$("#createQuestion-FibFixedplace").dialog("open");
		}
	});

	$("#Qtype").bind("change", function() {
		if ($(this).val() == "7") {
			$("#create-a-question").dialog("close");
			$("#createQuestion-FibSingleCorrect").dialog("open");
		}
	});

	$("#Qtype").bind("change", function() {
		if ($(this).val() == "11") {
			$("#create-a-question").dialog("close");
			$("#createQuestion-Sequencing").dialog("open");
		}
	});

	$("#Qtype").bind("change", function() {
		if ($(this).val() == "8") {
			$("#create-a-question").dialog("close");
			$("#createQuestion-TrueFalse").dialog("open");
		}
	});

	$("#Qtype").bind("change", function() {
		if ($(this).val() == "9") {
			$("#create-a-question").dialog("close");
			$("#createQuestion-MatchColumnsEqual").dialog("open");
		}
	});

	$("#Qtype").bind("change", function() {
		if ($(this).val() == "10") {
			$("#create-a-question").dialog("close");
			$("#createQuestion-MatchColumnsUnequal").dialog("open");
		}
	});

	$("#Qtype").bind("change", function() {
		if ($(this).val() == "12") {
			$("#create-a-question").dialog("close");
			$("#createQuestion-OpenEndedQuestions").dialog("open");
		}
	});

	$("#Qtype").bind("change", function() {
		if ($(this).val() == "13") {
			$("#create-a-question").dialog("close");
			$("#createQuestion-DiagramLabelling").dialog("open");
		}
	});

	$("#Qtype").bind("change", function() {
		if ($(this).val() == "14") {
			$("#create-a-question").dialog("close");
			$("#createQuestion-DiagramLabellingwithQ").dialog("open");
		}
	});

	$("#create-a-question #cencelBox").click(function() {
		$("#create-a-question").dialog("close");
	});

	/* Create a Question step 2 | Question Type: MCQ Single Select Popup */
	$("#createQuestion-MCQSingleSelct").dialog({
		autoOpen : false,
		height : 800,
		width : 800,
		modal : true
	});

	$("#createQuestion-MCQSingleSelct #save").click(function() {
		$("#createQuestion-MCQSingleSelct").dialog("close");
	});
	$("#createQuestion-MCQSingleSelct #preview").click(function() {
		$("#createQuestion-MCQSingleSelctPreview").dialog("open");
	});

	$("#createQuestion-MCQSingleSelct #cencelBox").click(function() {
		$("#createQuestion-MCQSingleSelct").dialog("close");
	});

	/* Create a Question step 2 > Preview Popup | Question Type: MCQ Single Select Popup */
	$("#createQuestion-MCQSingleSelctPreview").dialog({
		autoOpen : false,
		width : 600,
		modal : true
	});

	$("#createQuestion-MCQSingleSelctPreview #okay").click(function() {
		$("#createQuestion-MCQSingleSelctPreview").dialog("close");
	});
	$("#createQuestion-MCQSingleSelctPreview #cencelBox").click(function() {
		$("#createQuestion-MCQSingleSelctPreview").dialog("close");
	});

	/* Create a Question step 2 | Question Type: MCQ Multiple Select Popup */
	$("#createQuestion-MCQMultipleSelct").dialog({
		autoOpen : false,
		height : 800,
		width : 800,
		modal : true
	});

	$("#createQuestion-MCQMultipleSelct #save").click(function() {
		$("#createQuestion-MCQMultipleSelct").dialog("close");
	});
	$("#createQuestion-MCQMultipleSelct #preview").click(function() {
		$("#createQuestion-MCQMultipleSelct").dialog("close");
	});

	$("#createQuestion-MCQMultipleSelct #cencelBox").click(function() {
		$("#createQuestion-MCQMultipleSelct").dialog("close");
	});

	/* Create a Question step 2 | Question Type: MCQ Multiple Select Popup */
	$("#createQuestion-MCQTwoOpt").dialog({
		autoOpen : false,
		width : 600,
		modal : true
	});

	$("#createQuestion-MCQTwoOpt #save").click(function() {
		$("#createQuestion-MCQTwoOpt").dialog("close");
	});
	$("#createQuestion-MCQTwoOpt #preview").click(function() {
		$("#createQuestion-MCQTwoOpt").dialog("close");
	});

	$("#createQuestion-MCQTwoOpt #cencelBox").click(function() {
		$("#createQuestion-MCQTwoOpt").dialog("close");
	});

	/* Create a Question step 2 | Question Type: FIB- without options � interchangeable answers Popup */
	$("#createQuestion-FibInterchangable").dialog({
		autoOpen : false,
		width : 600,
		modal : true
	});

	$("#createQuestion-FibInterchangable #save").click(function() {
		$("#createQuestion-FibInterchangable").dialog("close");
	});

	$("#createQuestion-FibInterchangable #QuesOkay").click(function() {
		$("#Qtype-FibInterchangableAnswerDiv").css("visibility", "visible");
	});

	$("#createQuestion-FibInterchangable #preview").click(function() {
		$("#createQuestion-FibInterchangablePreview").dialog("open");
	});

	$("#createQuestion-FibInterchangable #cencelBox").click(function() {
		$("#createQuestion-FibInterchangable").dialog("close");
	});

	/* Create a Question step 2 | Question Type: FIB- without options � Fixed place answers Popup */
	$("#createQuestion-FibFixedplace").dialog({
		autoOpen : false,
		width : 600,
		modal : true
	});

	$("#createQuestion-FibFixedplace #save").click(function() {
		$("#createQuestion-FibFixedplace").dialog("close");
	});

	$("#createQuestion-FibFixedplace #QuesOkay1").click(function() {
		$("#Qtype-FibFixedplaceAnswerDiv").css("visibility", "visible");
	});

	$("#createQuestion-FibFixedplace #preview").click(function() {
		$("#createQuestion-FibFixedplacePreview").dialog("open");
	});

	$("#createQuestion-FibFixedplace #cencelBox").click(function() {
		$("#createQuestion-FibFixedplace").dialog("close");
	});

	/* Create a Question step 2 | Question Type: FIB- without options � interchangeable answers PREVIEW Popup */
	$("#createQuestion-FibFixedplacePreview").dialog({
		autoOpen : false,
		width : 600,
		modal : true
	});

	$("#createQuestion-FibFixedplacePreview #previewOkay").click(function() {
		$("#createQuestion-FibFixedplacePreview").dialog("close");
	});

	$("#createQuestion-FibFixedplacePreview #cencelBox").click(function() {
		$("#createQuestion-FibFixedplacePreview").dialog("close");
	});

	/* Create a Question step 2 | Question Type: FIB- without options � interchangeable answers PREVIEW Popup */
	$("#createQuestion-FibInterchangablePreview").dialog({
		autoOpen : false,
		width : 600,
		modal : true
	});

	$("#createQuestion-FibInterchangablePreview #previewOkay").click(function() {
		$("#createQuestion-FibInterchangablePreview").dialog("close");
	});

	$("#createQuestion-FibInterchangablePreview #cencelBox").click(function() {
		$("#createQuestion-FibInterchangablePreview").dialog("close");
	});

	/* Create a Question step 2 | Question Type: FIB- with options � single correct Popup */
	$("#createQuestion-FibSingleCorrect").dialog({
		autoOpen : false,
		width : 600,
		modal : true
	});

	$("#createQuestion-FibSingleCorrect #save").click(function() {
		$("#createQuestion-FibSingleCorrect").dialog("close");
	});

	$("#createQuestion-FibSingleCorrect #QuesOkay").click(function() {
		$("#Qtype-FibSingleCorrectAnswerDiv").css("visibility", "visible");
	});

	$("#createQuestion-FibSingleCorrect #preview").click(function() {
		$("#createQuestion-FibSingleCorrectPreview").dialog("open");
	});

	$("#createQuestion-FibSingleCorrect #cencelBox").click(function() {
		$("#createQuestion-FibSingleCorrect").dialog("close");
	});

	/* Create a Question step 2 | Question Type: FIB- with options � single correct PREVIEW Popup */
	$("#createQuestion-FibSingleCorrectPreview").dialog({
		autoOpen : false,
		width : 600,
		modal : true
	});

	$("#createQuestion-FibSingleCorrectPreview #previewOkay").click(function() {
		$("#createQuestion-FibSingleCorrectPreview").dialog("close");
	});

	$("#createQuestion-FibSingleCorrectPreview #cencelBox").click(function() {
		$("#createQuestion-FibSingleCorrectPreview").dialog("close");
	});

	/* Create a Question step 2 | Question Type: Sequencing (Put in correct sequence) Popup */
	$("#createQuestion-Sequencing").dialog({
		autoOpen : false,
		width : 600,
		modal : true
	});

	$("#createQuestion-Sequencing #QuesOkay").click(function() {
		$("#Qtype-SequencingAnswerDiv").css("visibility", "visible");
	});

	$("#createQuestion-Sequencing #previewBtn").click(function() {
		$("#createQuestion-SequencingPreview").dialog("open");
	});

	$("#createQuestion-Sequencing #save").click(function() {
		$("#createQuestion-Sequencing").dialog("close");
	});

	$("#createQuestion-Sequencing #cencelBox").click(function() {
		$("#createQuestion-Sequencing").dialog("close");
	});

	/* Create a Question step 2 | Sequencing PREVIEW Popup */
	$("#createQuestion-SequencingPreview").dialog({
		autoOpen : false,
		width : 600,
		modal : true
	});

	$("#createQuestion-SequencingPreview #previewOkay").click(function() {
		$("#createQuestion-SequencingPreview").dialog("close");
	});

	$("#createQuestion-SequencingPreview #cencelBox").click(function() {
		$("#createQuestion-SequencingPreview").dialog("close");
	});

	/* Create a Question step 2 | Question Type: True or False Popup */
	$("#createQuestion-TrueFalse").dialog({
		autoOpen : false,
		width : 600,
		modal : true
	});

	$("#createQuestion-TrueFalse #previewBtn").click(function() {
		$("#createQuestion-TrueFalsePreview").dialog("open");
	});

	$("#createQuestion-TrueFalse #save").click(function() {
		$("#createQuestion-TrueFalse").dialog("close");
	});

	$("#createQuestion-TrueFalse #cencelBox").click(function() {
		$("#createQuestion-TrueFalse").dialog("close");
	});

	/* Create a Question step 2 | True or False PREVIEW Popup */
	$("#createQuestion-TrueFalsePreview").dialog({
		autoOpen : false,
		width : 600,
		modal : true
	});

	$("#createQuestion-TrueFalsePreview #previewOkay").click(function() {
		$("#createQuestion-TrueFalsePreview").dialog("close");
	});

	$("#createQuestion-TrueFalsePreview #cencelBox").click(function() {
		$("#createQuestion-TrueFalsePreview").dialog("close");
	});

	/* Create a Question step 2 | Question Type: Diagram Labelling */
	$("#createQuestion-DiagramLabelling").dialog({
		autoOpen : false,
		width : 600,
		modal : true
	});

	$("#createQuestion-DiagramLabelling #previewBtn").click(function() {
		$("#createQuestion-DiagramLabellingPreview").dialog("open");
	});

	$("#createQuestion-DiagramLabelling #save").click(function() {
		$("#createQuestion-DiagramLabelling").dialog("close");
	});

	$("#createQuestion-DiagramLabelling #cencelBox").click(function() {
		$("#createQuestion-DiagramLabelling").dialog("close");
	});

	/* Create a Question step 2 | Diagram Labelling PREVIEW Popup */
	$("#createQuestion-DiagramLabellingPreview").dialog({
		autoOpen : false,
		width : 600,
		modal : true
	});

	$("#createQuestion-DiagramLabellingPreview #previewOkay").click(function() {
		$("#createQuestion-DiagramLabellingPreview").dialog("close");
	});

	$("#createQuestion-DiagramLabellingPreview #cencelBox").click(function() {
		$("#createQuestion-DiagramLabellingPreview").dialog("close");
	});

	/* Create a Question step 2 | Question Type: Diagram Labelling with Questions*/
	$("#createQuestion-DiagramLabellingwithQ").dialog({
		autoOpen : false,
		width : 600,
		modal : true
	});

	$("#createQuestion-DiagramLabellingwithQ #previewBtn").click(function() {
		$("#createQuestion-DiagramLabellingwithQPreview").dialog("open");
	});

	$("#createQuestion-DiagramLabellingwithQ #save").click(function() {
		$("#createQuestion-DiagramLabellingwithQ").dialog("close");
	});

	$("#createQuestion-DiagramLabellingwithQ #cencelBox").click(function() {
		$("#createQuestion-DiagramLabellingwithQ").dialog("close");
	});

	/* Create a Question step 2 | Diagram Labelling PREVIEW Popup */
	$("#createQuestion-DiagramLabellingwithQPreview").dialog({
		autoOpen : false,
		width : 600,
		modal : true
	});

	$("#createQuestion-DiagramLabellingwithQPreview #previewOkay").click(function() {
		$("#createQuestion-DiagramLabellingwithQPreview").dialog("close");
	});

	$("#createQuestion-DiagramLabellingwithQPreview #cencelBox").click(function() {
		$("#createQuestion-DiagramLabellingwithQPreview").dialog("close");
	});

	/* Create a Question step 2 | Question Type: Open ended Questions*/
	$("#createQuestion-OpenEndedQuestions").dialog({
		autoOpen : false,
		width : 600,
		modal : true
	});

	$("#createQuestion-OpenEndedQuestions #previewBtn").click(function() {
		$("#createQuestion-OpenEndedQuestionsPreview").dialog("open");
	});

	$("#createQuestion-OpenEndedQuestions #save").click(function() {
		$("#createQuestion-OpenEndedQuestions").dialog("close");
	});

	$("#createQuestion-OpenEndedQuestions #cencelBox").click(function() {
		$("#createQuestion-OpenEndedQuestions").dialog("close");
	});

	/* Create a Question step 2 | Question Type: Match the Columns Equal Popup */
	$("#createQuestion-MatchColumnsEqual").dialog({
		autoOpen : false,
		width : 600,
		modal : true
	});

	// Add a match for pair 1
	$("#createQuestion-MatchColumnsEqual #add-match-1").click(function() {
		$("#pair1-match2").show();
		$("#pair1-match1-del").show();
	});
	// Delete a match for pair 1
	$("#createQuestion-MatchColumnsEqual #pair1-match2-del").click(function() {
		$("#pair1-match2").hide();
		$("#pair1-match1-del").hide();
	});
	$("#createQuestion-MatchColumnsEqual #pair1-match1-del").click(function() {
		$("#pair1-match2").hide();
		$("#pair1-match1-del").hide();
	});

	$("#createQuestion-MatchColumnsEqual #previewBtn").click(function() {
		$("#createQuestion-MatchColumnsEqualPreview").dialog("open");
	});

	$("#createQuestion-MatchColumnsEqual #save").click(function() {
		$("#createQuestion-MatchColumnsEqual").dialog("close");
	});

	$("#createQuestion-MatchColumnsEqual #cencelBox").click(function() {
		$("#createQuestion-MatchColumnsEqual").dialog("close");
	});

	/* Create a Question step 2 | Match the Columns PREVIEW Popup */
	$("#createQuestion-MatchColumnsEqualPreview").dialog({
		autoOpen : false,
		width : 600,
		modal : true
	});

	$("#createQuestion-MatchColumnsEqualPreview #previewOkay").click(function() {
		$("#createQuestion-MatchColumnsEqualPreview").dialog("close");
	});

	$("#createQuestion-MatchColumnsEqualPreview #cencelBox").click(function() {
		$("#createQuestion-MatchColumnsEqualPreview").dialog("close");
	});

	/* Create a Question step 2 | Question Type: Match the Columns UnEqual Popup */
	$("#createQuestion-MatchColumnsUnequal").dialog({
		autoOpen : false,
		width : 600,
		modal : true
	});

	// Add a match for pair 1
	$("#createQuestion-MatchColumnsUnequal #add-match-1").click(function() {
		$("#pair1-match2").show();
		$("#pair1-match1-del").show();
	});
	// Delete a match for pair 1
	$("#createQuestion-MatchColumnsUnequal #pair1-match2-del").click(function() {
		$("#pair1-match2").hide();
		$("#pair1-match1-del").hide();
	});
	$("#createQuestion-MatchColumnsUnequal #pair1-match1-del").click(function() {
		$("#pair1-match2").hide();
		$("#pair1-match1-del").hide();
	});

	$("#createQuestion-MatchColumnsUnequal #previewBtn").click(function() {
		$("#createQuestion-MatchColumnsUnequalPreview").dialog("open");
	});

	$("#createQuestion-MatchColumnsUnequal #save").click(function() {
		$("#createQuestion-MatchColumnsUnequal").dialog("close");
	});

	$("#createQuestion-MatchColumnsUnequal #cencelBox").click(function() {
		$("#createQuestion-MatchColumnsUnequal").dialog("close");
	});

	/* Create a Question step 2 | Match the Columns PREVIEW Popup */
	$("#createQuestion-MatchColumnsUnequalPreview").dialog({
		autoOpen : false,
		width : 600,
		modal : true
	});

	$("#createQuestion-MatchColumnsUnequalPreview #previewOkay").click(function() {
		$("#createQuestion-MatchColumnsUnequalPreview").dialog("close");
	});

	$("#createQuestion-MatchColumnsUnequalPreview #cencelBox").click(function() {
		$("#createQuestion-MatchColumnsUnequalPreview").dialog("close");
	});

	

	//Add Marks dialog box
	/*$( "#addMark" ).dialog({
	 autoOpen: false,
	 width: 400,
	 modal: true
	 });
	 $( ".addMark" ).click(function() {
	 $( "#addMark" ).dialog( "open" );
	 });
	 $( "#addMark #proceed" ).click(function() {
	 $( "#addMark" ).dialog( "close" );
	 $( "#addMark2" ).dialog( "open" );
	 });
	 $( "#addMark #cencel" ).click(function() {
	 $( "#addMark" ).dialog( "close" );
	 });

	 $( "#addMark2" ).dialog({
	 autoOpen: false,
	 width: 965,
	 modal: true
	 });

	 $( "#addMark2 #save" ).click(function() {
	 $( "#addMark2" ).dialog( "close" );
	 });*/

	/* Geography Cirriculum Popup */
	$("#geography-cirriculum").dialog({
		autoOpen : false,
		width : 600,
		modal : true
	});
	$(".geographyCirriculumLink").click(function() {
		$("#geography-cirriculum").dialog("open");
	});
	$("#geography-cirriculum #okayBtn").click(function() {
		$("#geography-cirriculum").dialog("close");

	});
	$("#geography-cirriculum #cencelBox").click(function() {
		$("#geography-cirriculum").dialog("close");
	});

	/* Geography Homework Popup */
	$("#geography-homework").dialog({
		autoOpen : false,
		width : 600,
		modal : true
	});
	$(".geographyHomeworkLink").click(function() {
		$("#geography-homework").dialog("open");
	});
	$("#geography-homework #okayBtn").click(function() {
		$("#geography-homework").dialog("close");

	});
	$("#geography-homework #cencelBox").click(function() {
		$("#geography-homework").dialog("close");
	});

	/* Geography Cirriculum Popup (Parent Dashboard - Performance) */
	$("#performance-geography-cirriculum").dialog({
		autoOpen : false,
		width : 600,
		modal : true
	});
	$(".performanceGeographyCirriculumLink").click(function() {
		$("#performance-geography-cirriculum").dialog("open");
	});
	$("#performance-geography-cirriculum #okayBtn").click(function() {
		$("#performance-geography-cirriculum").dialog("close");

	});
	$("#performance-geography-cirriculum #cencelBox").click(function() {
		$("#performance-geography-cirriculum").dialog("close");
	});

	/*Active Inactive block function*/

	/*$('.activeTab a').click(function(){
	 var $this = $(this);
	 $this.parent().find('a').removeClass('active');
	 $this.parent().find('a').addClass('inActive');
	 $this.addClass('active');
	 $this.removeClass('inActive');

	 });*/

	/*Delete block function*/

	$("#dialog-confirm").dialog({
		autoOpen : false,
		width : 420,
		modal : true
	});
	$(".deleteIconTitle, .deleteRow, .delete").each(function() {
		var grp = $(this).parent('h3.ui-state-active').parent('div.group').addClass('sdasd');
		var divdel = $(this).parent('div.chptrRow');

		$(this).click(function(event) {
			$("#dialog-confirm").dialog("open");
			divdel.addClass('del');
		});
	});
	$("#dialog-confirm #delete").click(function() {
		$("#dialog-confirm").dialog("close");
		// Commented By Yugan ~ Delete is handled using Knockout
		/* START
		 $("h3.ui-state-active").next('div').remove();
		 $("h3.ui-state-active").remove();
		 $('div.del').remove();
		 grp.remove();

		 END
		 * */

	});
	$("#dialog-confirm #cencel").click(function() {
		$("#dialog-confirm").dialog("close");
		// Commented By Yugan ~ Delete is handled using Knockout
		/* START
		 $('div.chptrRow').removeClass('del');

		 END
		 * */
	});

	$("#dialog-confirm1").dialog({
		autoOpen : false,
		width : 420,
		modal : true
	});

	$(".deleteIcon, .crossIcon").each(function() {
		$(this).click(function() {
			$("#dialog-confirm1").dialog("open");
			$(this).addClass('remove');
		});
	});
	$("#dialog-confirm1 #delete").click(function() {
		$("#dialog-confirm1").dialog("close");
		var divparent = $('.remove').closest('div, tr, li');
		divparent.remove();
	});
	$("#dialog-confirm1 #cencel").click(function() {
		$("#dialog-confirm1").dialog("close");
	});

	$("#dialog-confirm2").dialog({
		autoOpen : false,
		width : 420,
		modal : true
	});

	$(".deleteIcon").each(function() {
		$(this).click(function() {
			$("#dialog-confirm2").dialog("open");
			$(this).addClass('remove');
		});
	});
	$("#dialog-confirm2 #delete").click(function() {

		$("#dialog-confirm2").dialog("close");
		var divparent = $('.remove').closest('.heading1,.unique');
		divparent.remove();

	});
	$("#dialog-confirm2 #cencel").click(function() {
		$("#dialog-confirm2").dialog("close");
	});

	/*Select Class Room function*/

	$('a.seletc').click(function() {
		var div = $(this).siblings('div.showBox, ul.selectClass');
		div.addClass('up');
		div.toggle();
		//		$(this).mouseout(function(){
		//			div.removeClass('up');
		//			div.hide();
		//		});
		//		div.mouseenter(function(){
		//			div.addClass('up');
		//			div.show();
		//		});
		//		div.mouseleave(function(){
		//			div.removeClass('up');
		//			div.hide();
		//		});
		$('#ok').click(function() {
			div.hide();
		});
		$('#cencelBox').click(function() {
			div.hide();
		});

		var room = $('.showBox a.room');

		room.click(function() {
			$('.showBox a.room').removeClass('add');
			$(this).addClass('add');
		});
		room.dblclick(function() {
			$(this).removeClass('add');
		});

	});

});

$(function() {
	var availableTags = ["Ms. David", "Ms. Dave", "Ms. Daisy", "Mr. Darshan Pandya"];
	$(".sugges").autocomplete({
		source : availableTags
	});

	var spinner = $(".timeSpinner").spinner();

	$("#shifts").buttonset();

	$("#progressTracker").buttonset();

	$(".roomWrap").buttonset();

	$('#sliderRange .circle').click(function() {
		var arow = $(this).children('div.arrow');
		$('#sliderRange .arrow').removeClass('active');
		arow.addClass('active');
	});

	$('.promote tr').each(function() {
		$(this).hover(function() {
			var btns = $(this).children('td.addButton');
			btns.children('a.button, a.editIcon, a.deleteIcon').css({
				'visibility' : 'visible'
			});
		});
		$(this).mouseleave(function() {
			var btns = $(this).children('td.addButton');
			btns.children('a.button').css({
				'visibility' : 'hidden'
			});
		});
	});

});

$.widget("ui.timespinner", $.ui.spinner, {
	options : {
		// seconds
		step : 60 * 1000,
		// hours
		page : 60
	},

	_parse : function(value) {
		if ( typeof value === "string") {
			// already a timestamp
			if (Number(value) == value) {
				return Number(value);
			}
			return +Globalize.parseDate(value);
		}
		return value;
	},

	_format : function(value) {
		return Globalize.format(new Date(value), "t");
	}
});

$(function() {
	$(".spinnerT").timespinner();
});

/* Function to show appropriate Filter options (view_questions.html)  */
$(function() {
	$('#questionTypeOpt').click(function(event) {
		$('#questionTypeDropdown').show();
		$('#complexityDropdown').hide();
		$('#chapterDropdown').hide();
	});

	$('#complexityOpt').click(function(event) {
		$('#complexityDropdown').show();
		$('#questionTypeDropdown').hide();
		$('#chapterDropdown').hide();
	});

	$('#chapterOpt').click(function(event) {
		$('#chapterDropdown').show();
		$('#questionTypeDropdown').hide();
		$('#complexityDropdown').hide();
	});
});

$(function() {
	$('.trmShow').each(function() {
		var th = $(this).parent('td');
		var htd = th.parent('tr.termTr');

		$(this).click(function() {
			htd.nextAll('tr').children('td.tdShow').toggle();
			$(this).toggleClass('arowR');

		});
	});

	$('.newAsse').click(function() {
		$('.newAsseBox').show();
		$('.plAsseBox').hide();
	});
	$('.plAsse').click(function() {
		$('.newAsseBox').hide();
		$('.plAsseBox').show();
	});

});

/* Table scroll */
$(function() {
	$('.sBWrapper, .SBWrapper').scroll(function() {
		var rc = $(this).closest('.relativeContainer');
		var lfW = rc.find('.leftSBWrapper');
		var tpW = rc.find('.topSBWrapper');

		lfW.css('top', ($(this).scrollTop() * -1));
		tpW.css('left', ($(this).scrollLeft() * -1));

		//var ltscr_cls =
		var ltscr_top = $(".SBWrapper .jspPane, .sBWrapper .jspPane").css('top');
		var ltscr_left = $(".SBWrapper .jspPane, .sBWrapper .jspPane").css('left');

		$(".leftSBWrapper").css("top", ltscr_top);
		$(".topSBWrapper").css("left", ltscr_left);
	});

});
$(function() {

	$("#student_Agarwal").mouseenter(function() {
		$("#studentInfoBox").show();
		$("#student_Agarwal").addClass('graphStudentNameBoxHover');

	});

	$("#student_Agarwal").mouseleave(function() {
		$("#studentInfoBox").hide();
		$("#student_Agarwal").addClass('graphStudentNameBox');
	});
});

$(document).ready(function() {

})
$(".SBWrapper .jspPane, .sBWrapper .jspPane").scroll(function() {
	alert("hi");
	//var sr_left = $(".SBWrapper .jspPane").scrollTop();
	//$(".leftSBWrapper").css("top", +(".SBWrapper .jspPane").css("top"));
});
function downelement(ele) {
	//$(ele).parent().attr("id")
	var thisitem = $(ele).parent().parent().parent().attr("id");
	var nextitem = $("#" + thisitem).next().attr("id");
	//alert(thisitem +" "+ nextitem)
	thisitemhtml = $("#" + thisitem).html();
	nextitemhtml = $("#" + nextitem).html();
	$("#" + nextitem).html(thisitemhtml);
	$("#" + thisitem).html(nextitemhtml);
	//console.log(thisitem +" "+nextitem);
	//console.log($("#"+nextitem).find("h3").attr("class"))
	//console.log($("#"+thisitem).find("h3").attr("class"))
	$("#" + thisitem).find("h3").attr("class", "floorAdded bold ui-accordion-header ui-helper-reset ui-state-default ui-accordion-icons ui-corner-all");
	$("#" + nextitem).find("h3").attr("class", "floorAdded bold ui-accordion-header ui-helper-reset ui-state-default ui-accordion-icons ui-corner-all");
	//console.log($("#accordionSortable .group").length)
	$("#accordionSortable").accordion("refresh");
	for (var i = 0; i < $("#accordionSortable .group").length; i++) {
		if (nextitem == "item" + i) {
			console.log("i = " + i);
			$("#accordionSortable").accordion({
				active : i
			});
		}
	}

}

function upelement(ele) {
	//alert("up = "+ $(ele).next().attr("id"));
	var thisitem1 = $(ele).parent().parent().parent().attr("id");
	var previtem1 = $("#" + thisitem1).prev().attr("id");
	thisitemhtml1 = $("#" + thisitem1).html();
	previtemhtml1 = $("#" + previtem1).html();
	$("#" + thisitem1).html(previtemhtml1);
	$("#" + previtem1).html(thisitemhtml1);

	if ($("#" + thisitem1).hasClass("sdasd")) {
		$("#" + thisitem1).removeClass("sdasd");
		$("#" + previtem1).addClass("sdasd");
	}
	$("#" + thisitem1).find("h3").attr("class", "floorAdded bold ui-accordion-header ui-helper-reset ui-state-default ui-accordion-icons ui-corner-all");
	$("#" + previtem1).find("h3").attr("class", "floorAdded bold ui-accordion-header ui-helper-reset ui-state-default ui-accordion-icons ui-corner-all");
	$("#accordionSortable").accordion("refresh");
	//console.log($("#accordionSortable .group").length)
	for (var i = 0; i < $("#accordionSortable .group").length; i++) {
		if (previtem1 == "item" + i) {
			console.log("i = " + i + "  /  " + thisitem1);
			$("#accordionSortable").accordion({
				active : i
			});
		}
	}
}

/* Function to show Answer options on click on OK in Create a Question - Step 2 popup (FIB- without options � interchangeable answers)

$(function () {
$('#createQuestion-FibInterchangable #okay').click(function(event)
{
alert();
$('#Qtype-FibInterchangableAnswerDiv').css("visibility","visible");
}
);
});*/

/****Verticle tabs***/

$(function() {
	$(".graphStudentNameBox").click(function() {
		$(".graphStudentBoxOpen", this).toggle();
	});
});

/* Table scroll */
function tableScroll() {
	$('.current .sBWrapper, .current .SBWrapper').scroll(function() {
		var rc = $('.current .relativeContainer');

		var lfW = rc.find('.current .leftSBWrapper');
		var tpW = rc.find('.current .topSBWrapper');

		lfW.css('top', ($(this).scrollTop() * -1));
		tpW.css('left', ($(this).scrollLeft() * -1));

		//var ltscr_cls =
		var ltscr_top = $(".current .SBWrapper .jspPane, .current .sBWrapper .jspPane").css('top');
		var ltscr_left = $(".current .SBWrapper .jspPane, .current .sBWrapper .jspPane").css('left');

		$(".leftSBWrapper").css("top", ltscr_top);
		$(".topSBWrapper").css("left", ltscr_left);
	});

}

$(function() {
	tableScroll();
	$('#termselector, #fasaSelector').change(function() {
		$('.terms').hide();
		$('.fasa').hide();
		$('.terms').removeClass('current');
		$('.fasa').removeClass('current');
		$('#' + $(this).val()).addClass('current').show();
		tableScroll();
	});
});

$(function() {
	$('.singleWrap .SBWrapper').scroll(function() {
		var rc = $('.singleWrap .relativeContainer');

		var lfW = rc.find('.singleWrap .leftSBWrapper');
		var tpW = rc.find('.singleWrap .topSBWrapper');

		lfW.css('top', ($(this).scrollTop() * -1));
		tpW.css('left', ($(this).scrollLeft() * -1));

		//var ltscr_cls =
		var ltscr_top = $(".singleWrap .SBWrapper .jspPane").css('top');
		var ltscr_left = $(".singleWrap .SBWrapper .jspPane").css('left');

		$(".leftSBWrapper").css("top", ltscr_top);
		$(".topSBWrapper").css("left", ltscr_left);
	});

});

$(function() {
	$("#sortable").sortable();
	$("#sortable").disableSelection();
});

/****Verticle tabs***/

$(function() {
	$(".commonToggle li").click(function() {
		$(".graphStudentBoxOpen", this).toggle();
		$(".graphStudentNameBox", this).toggle();
	});
});

$(function() {
	$(".eventExpand").click(function() {
		$(".eventExpand").toggle();
		$(".eventCollapse").toggle();
		$(".eventsmallTab").toggle();
		$(".eventsTab").toggle();

		$(".attendenceTab").toggle();
		$(".attsmallTab").toggle();

		$(".dlogsmallTab").toggle();
		$(".dailylogTab").toggle();
	});
	$(".eventCollapse").click(function() {
		$(".eventCollapse").toggle();
		$(".eventExpand").toggle();

		$(".eventsTab").toggle();
		$(".eventsmallTab").toggle();

		$(".attsmallTab").toggle();
		$(".attendenceTab").toggle();

		$(".dailylogTab").toggle();
		$(".dlogsmallTab").toggle();

	});

});
$(function() {
	$(".eventsMore").click(function() {
		$(".eventsMore").toggle();
		$(".eventsCustomlist1").toggle();
		$(".eventsLess").toggle();

	});

	$(".eventsLess").click(function() {
		$(".eventsLess").toggle();
		$(".eventsMore").toggle();
		$(".eventsCustomlist1").toggle();
	});
});

$(function() {
	$(".additionalDetails").click(function() {
		$(this).toggle();
		$(this).parent().parent().find(".additionalDetailsDiv").toggle();
		$(this).parent().find(".LessDetails").toggle();
	});
	$(".LessDetails").click(function() {
		$(this).toggle();
		$(this).parent().parent().find(".additionalDetailsDiv").toggle();
		$(this).parent().find(".additionalDetails").toggle();
	});
});

$(function() {

	$(".eventListView").click(function() {
		$(".eventsCustomCal").toggle();
		$(".eventsCustomlist").toggle();
	});

	$(".eventCalender").click(function() {
		$(".eventsCustomlist").toggle();
		$(".eventsCustomCal").toggle();
	});

	$(".unmarkedAttendence").click(function() {
		$(".AttendenceCustomCal").toggle();
		$(".attCustomlist").toggle();
	});

	$(".attCalender").click(function() {
		$(".attCustomlist").toggle();
		$(".AttendenceCustomCal").toggle();
	});

	$(".unmarkedLog").click(function() {
		$(".DailyLogCustomCal").toggle();
		$(".dailyloglist").toggle();
	});

	$(".dailylogCalender").click(function() {
		$(".dailyloglist").toggle();
		$(".DailyLogCustomCal").toggle();
	});

});

